<template>
  <el-dialog title="销售状态设置" :visible.sync="dialogVisible" width="1200px" :close-on-click-modal="false"
    :modal-append-to-body="false" v-drag2anywhere>
    <div>
      <el-row>
        <el-col>
          <div class="title">采购明细</div>
          <el-table :data="tableData" border>
            <el-table-column prop="reqcode" label="采购单号" width="120px"></el-table-column>
            <el-table-column prop="title" label="产品名称"></el-table-column>
            <el-table-column prop="brand" label="品牌" width="100px" show-overflow-tooltip></el-table-column>
            <el-table-column prop="model" label="规格" width="80px" show-overflow-tooltip></el-table-column>
            <el-table-column prop="count" label="数量" width="80px" align="center"></el-table-column>
            <el-table-column prop="price" label="单价" width="90px" align="center"></el-table-column>
            <el-table-column prop="total" label="总价" width="90px" align="center"></el-table-column>
            <el-table-column prop="yunfei" label="运费" width="120px" align="center"></el-table-column>
            <el-table-column prop="tickettype" label="发票类型" width="120px" align="center">
              <template v-slot="scope">
                {{formData.tickettype}}({{formData.ticketrate}})
              </template>
            </el-table-column>
            <el-table-column prop="supname" label="供应商" show-overflow-tooltip></el-table-column>
          </el-table>
        </el-col>
        <el-col>

          <div style="margin: 20px 0px 0px 0px;">
            <el-form label-width="80px">
              <div style="text-align: right; padding: 2px 2px 5px 0px;display: flex;">
                <div>

                </div>
              </div>
              <el-row :gutter="20">
                <el-col :span="12">
                    <div class="title">已关联销售订单</div>
                    <!--绑定进项明细-->
                    <el-table border :data="orderlist" empty-text="暂未绑定销售订单!" style="overflow-y: auto;">
                      <el-table-column label="序号" type="index" align="center"></el-table-column>
                      <el-table-column label="订单类型" prop="type" align="center"></el-table-column>
                      <el-table-column label="订单号" prop="order" align="center"></el-table-column>
                    </el-table>
                </el-col>
                <el-col :span="12">
                  <div class="title">销售状态设置</div>
                       <div>
                         <el-form-item label="销售状态:">
                           <el-select v-model="formData.cost_soldstatus" placeholder="请选择">
                             <el-option label="未售" value="0"></el-option>
                             <el-option label="已售" value="1"></el-option>
                             <el-option label="部分" value="2"></el-option>
                           </el-select>
                         </el-form-item>
                     </div>
                     <div>
                       <el-form-item label="销售备注:">
                         <el-input type="textarea" :rows="5" v-model="formData.cost_soldstatusmemo" placeholder="请填写强制销售状态原因">

                         </el-input>
                       </el-form-item>
                     </div>
                </el-col>
              </el-row>
            </el-form>
          </div>
        </el-col>
      </el-row>
    </div>
    <div slot="footer">
      <el-button size="medium">取消</el-button>
      <el-button type="primary" size="medium" @click="handleSave">确定</el-button>
    </div>
  </el-dialog>
</template>

<script>
  import BindBuyTicketUI from '@/components/BindBuyTicket.vue'
  export default {
    components: {
      BindBuyTicketUI
    },
    data() {
      return {
        index: -1,
        formData: {
          did: '',
          reqcode: '',
          buyticket_bindstatus: 0,
          buyticket_bindstatusmemo: ''
        },
        tableData:[],
        orderlist: [],
        dialogVisible: false,
      }
    },
    methods: {
      initData(index, data) {
        this.index = index;
        this.formData = data;
        this.tableData=[data];
        console.log(data);
        this.loadBindOrders();
      },
      loadBindOrders() {
        this.axios.post("api/admin/buydetail/get_bind_orders",{id:this.formData.did}).then(res=>{
          if(res.status==200 &&res.data.code==1){
            this.orderlist=res.data.list;
          }
        })
      },
      handleSave(){
        
      }
    }
  }
</script>

<style>
</style>
